package com.gw.service;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class SystemService {
	private final String SYSTEMTABLES = "information_schema.TABLES";
	private final String SYSTEMCOLUMNS = "information_schema.COLUMNS";
	private final String TABLE_SCHEMA = "TABLE_SCHEMA";
	private final String TABLE_NAME = "TABLE_NAME";
	private final String SELECT = "select * from ";
	
	public List<Record> getTableCol(String table_schema, String table_name){
		List<Record> list = Db.use("mysql").find(SELECT + SYSTEMCOLUMNS + " where TABLE_SCHEMA = ? and TABLE_NAME = ?", table_schema, table_name);
		return list;
	}
	
	
	public Record getTableInfo(String table_schema, String table_name){
		return Db.use("mysql").findFirst(SELECT + SYSTEMTABLES + " where TABLE_SCHEMA = ? and TABLE_NAME = ?", table_schema, table_name);
	}

}
